import os
path = os.path.dirname(__file__)
if not os.path.isdir(os.path.join(path, "testdata")):
    os.mkdir(os.path.join(path, "testdata"))
with open(os.path.join(path, "answer.txt"), "r", encoding="utf-8") as f:
    ans = f.read()
newans = ""
keys = ["√", "×", "x", "X"]
for i in range(len(ans)):
    if ans[i] in keys:
        newans += ans[i]
    elif ans[i] >= "A" and ans[i] <= "Z":
        newans += ans[i]
ans = newans
ans = ans.replace(" ", "")
ans = ans.replace("\r", "")
ans = ans.replace("\n", "")
ans = ans.replace("\t", "")
ans = ans.replace("√", "T")
ans = ans.replace("×", "F")
ans = ans.replace("x", "F")
ans = ans.replace("X", "F")
for i in range(1, len(ans)+1):
    with open(os.path.join(path, "testdata", f"{i}.in"), "w", encoding="utf-8") as f:
        f.write(str(i))
    with open(os.path.join(path, "testdata", f"{i}.out"), "w", encoding="utf-8") as f:
        f.write(ans[i-1])
print(ans)
